{% extends "base.html" %}

{% block title %}madman:{{ location }}{% endblock %}


{% block madmannav %}
    <a href="">location nav</a>
{% endblock %}

{% block content %}

<div class="grid_16"> 
    <div class="info">
        <h1>{{ location }}</h1>
    </div>
    <a href="{% url admin:madman_medialocation_change location.pk %}">Edit Location</a>
</div>
<div class="grid_8"> 
    {% if paginatedLocationList %}
    <div class="listBlock">
        <span class="listTitle">Locations In Location</span>
        
        {% for f in paginatedLocationList.object_list %}
        <div class="item
        {% if forloop.first %}item_top{% endif %}
        {% if forloop.last %}item_bottom{% endif %} 
        ">
            <a href="{{f.get_absolute_url}}"><img class="item_img" src="{{STATIC_URL}}img/milky/48/18.png"/></a>
            <span><a href="{{f.get_absolute_url}}">{{ f.name|title }}</a></span>
            <br/>
            <span> ({{ f.get_size }}) </span>
            <span>
                <a href="{% url admin:madman_medialocation_change f.pk %}">Edit</a>
            </span>
        </div>
        {% endfor %}
        
        <div class="pagination">
            <span class="step-links">
                {% if paginatedLocationList.has_previous %}
                    <a href="?locationpage={{ paginatedLocationList.previous_page_number }}">previous</a>
                {% endif %}

                <span class="current">
                    Page {{ paginatedLocationList.number }} of {{ paginatedLocationList.paginator.num_pages }}.
                </span>

                {% if paginatedLocationList.has_next %}
                    <a href="?locationpage={{ paginatedLocationList.next_page_number }}">next</a>
                {% endif %}
            </span>
        </div>
    </div>
    {% else %}
        <p>No locations for this media location.</p>
    {% endif %}
    <div class="listBlock">
        <span class="listTitle">Locations Inside</span>
        
        {% for f in location.get_children %}
        <div class="item
        {% if forloop.first %}item_top{% endif %}
        {% if forloop.last %}item_bottom{% endif %} 
        ">
            <img class="item_img" src="{{STATIC_URL}}img/milky/48/18.png"/> 
            <span><a href="/madman/location/{{ f.id }}/">{{ f.name }}</a> </span>
        </div>
        {% endfor %}
        
    </div>
</div> 
<div class="grid_8"> 
    {% if paginatedFileList %}
    <div class="listBlock">
        <span class="listTitle">Files In Location</span>
        
        {% for f in paginatedFileList.object_list %}
        <div class="item
        {% if forloop.first %}item_top{% endif %}
        {% if forloop.last %}item_bottom{% endif %} 
        ">
            <img class="item_img" src="{{STATIC_URL}}img/milky/48/18.png"/> 
            <span><a href="{{f.get_absolute_url}}">{{ f.name }}</a> ({{ f.get_size }}) </span>
            <span>
                <a href="{% url admin:madman_mediafile_change f.pk %}">Edit</a>
            </span>
        </div>
        {% endfor %}
        
        <div class="pagination">
            <span class="step-links">
                {% if paginatedFileList.has_previous %}
                    <a href="?filepage={{ paginatedFileList.previous_page_number }}">previous</a>
                {% endif %}

                <span class="current">
                    Page {{ paginatedFileList.number }} of {{ paginatedFileList.paginator.num_pages }}.
                </span>

                {% if paginatedFileList.has_next %}
                    <a href="?filepage={{ paginatedFileList.next_page_number }}">next</a>
                {% endif %}
            </span>
        </div>
    </div>
    {% else %}
        <p>No files for this media location.</p>
    {% endif %}
    <div class="listBlock">
        <span class="listTitle">Locations Inside</span>
        
        {% for f in location.get_children %}
        <div class="item
        {% if forloop.first %}item_top{% endif %}
        {% if forloop.last %}item_bottom{% endif %} 
        ">
            <img class="item_img" src="{{STATIC_URL}}img/milky/48/18.png"/> 
            <span><a href="/madman/location/{{ f.id }}/">{{ f.name }}</a> </span>
        </div>
        {% endfor %}
        
    </div>
</div> 
  

{% endblock %}



